﻿Public Class ctrKetNoi

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        frmMain.TabControl1.TabPages.Remove(frmMain.TabControl1.SelectedTab)
    End Sub

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        Dim dlg As OpenFileDialog = New OpenFileDialog()
        dlg.Filter = "Chon tap tin .mdb|*.mdb"
        If (dlg.ShowDialog() = DialogResult.OK) Then
            txtLink.Text = dlg.FileName
        End If
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Dim FileToCopy As String
        Dim NewCopy As String
        System.IO.File.Delete(Application.StartupPath() + "\QLNH.mdb")
        FileToCopy = txtLink.Text
        NewCopy = Application.StartupPath() + "\" + IO.Path.GetFileName(txtLink.Text)

        If System.IO.File.Exists(FileToCopy) = True Then

            System.IO.File.Copy(FileToCopy, NewCopy)

        End If

        MessageBox.Show("Kết nối dữ liệu thành công!!!")
    End Sub
End Class
